﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
    <script src="../JS/AjaxHelper.js"></script>
    <script type="text/javascript">
        function showHint(str) {
            var url = "WebFormMatchNames.aspx?q=" + str;
            try {
                var ajax = new AjaxHelper(url,
                    () => {
                        document.getElementById("txtHint").innerHTML = ajax.ajaxRequest.responseText;
                    },
                    () => {
                        document.getElementById("txtHint").innerHTML = ajax.ajaxRequest.responseText;
                    });
                ajax.getResponse();
            } catch (e) {
                console.log(e);
            }
        }
    </script>
</head>
<body>
    <h3>请在下面的输入框中键入字母（A - Z）：</h3>
    <form action="">
        姓氏：<input type="text" id="txt1" oninput="showHint(this.value)" />
    </form>
    <p>建议：<span id="txtHint"></span></p>

</body>
</html>